<!--父传子-->
<script setup>
import {ref} from 'vue'
import SonComponent from '@/components/SonComponent.vue'

const message = ref("父组件传给子组件的值")

const changeMessage = () => {
  message.value = "父组件中的message改变成这个了"
}
const sonCount = ref(0)
const getChangeCount = (val) => {
  console.log(val)
  sonCount.value = val
}

const changeMessagez = (val)=>{
  message.value = val
}
</script>


<template>
  <div>
    父组件中的message:{{ message }}
    <SonComponent :message=message @changeCount="getChangeCount" @changeMessages="changeMessagez"></SonComponent>
    <hr>
    <button @click="changeMessage">改变父组件中的message</button>
    <hr>
    父组件中展示子组件传过来的值：{{ sonCount }}
  </div>
</template>
